package me.project.android_common.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

@Data
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ToString
@TableName("mk_info")
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidInfo extends Model<AndroidInfo> {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @NotBlank
    @TableField("packageName")
    private String packageName;
    @NotBlank
    private String url;
    @NotBlank
    @TableField("appName")
    private String appName;
    @TableField("iconName")
    private String iconName;
    @TableField("apkPath")
    private String apkPath;
    @TableField("fullPath")
    private String fullPath;
    @TableField("buildTime")
    private String buildTime;
    private String uuid;
    @TableField("downloadUrl")
    private String downloadUrl;
    @TableField("appsflyerToken")
    private String appsflyerToken;
    @TableField("adjustToken")
    private String adjustToken;
    @NotBlank
    private String code;
    @TableField("iconUrl")
    private String iconUrl;
    @TableField(exist = false)
    private Set<DataPoint> dataPoints = new HashSet<>();
    @TableField("isPackage")
    private int isPackage;
    private String channel;
    @TableField("jksQr")
    private String jksQr;
    @TableField("apkQr")
    private String apkQr;

    public AndroidInfo(String packageName, String url, String appName, String iconName) {
        this.packageName = packageName;
        this.url = url;
        this.appName = appName;
        this.iconName = iconName;
    }

    public AndroidInfo() {
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
